home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / c / ExtrasLib.lha / ExtrasLib / Source / CInnerWinSize.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  1.7 KB  |  57 lines

  1. #include <clib/extras/gui_protos.h>
  2. #include <intuition/screens.h>
  3.  
  4. /****** extras.lib/OBSOLETE_CheckInnerWindowSize ******************************************
  5. *
  6. *   OBSOLETE
  7. *       Since OS3.5 uses Reaction/ClassAct - this code is obsolete
  8. *
  9. *   NAME
  10. *       CheckInnerWindowSize - See if a window will fit on a screen.
  11. *
  12. *   SYNOPSIS
  13. *       windowfits = CheckInnerWindowSize(Scr, Width, Height,
  14. *                                     XScale, YScale)
  15. *
  16. *       BOOL CheckInnerWindoeSize(struct Screen *, WORD, WORD, 
  17. *                                    float, float);
  18. *
  19. *   FUNCTION
  20. *       This function checks to see if a window with the specified
  21. *       inner dimensions will fit on a screen.
  22. *
  23. *   INPUTS
  24. *       Scr - the Screen the window is destine for.
  25. *       Width -  the base inner width of the window.
  26. *       Height - the base inner height of the window.
  27. *       XScale - the proposed x scale of the window.
  28. *       YScale - the proposed y scale of the window.
  29. *
  30. *   RESULT
  31. *       Returns TRUE if the window will fit, and FALSE if not.
  32. *       if the XScale or YScale is <=0 it will also fail.
  33. *
  34. *   SEE ALSO
  35. *       GetGUIScale(), CheckWindowSize()
  36. *
  37.  
  38. ******************************************************************************
  39. *
  40. */
  41.  
  42. BOOL CheckInnerWindowSize(struct Screen *Scr,
  43.                           WORD Width,
  44.                           WORD Height,
  45.                           float XScale,
  46.                           float YScale)
  47. {
  48.   if(XScale>0 && YScale>0)
  49.   {
  50.     Width= Width  * XScale + Scr->WBorLeft+Scr->WBorRight;
  51.     Height=Height * YScale + Scr->WBorTop + Scr->RastPort.TxHeight + 1 + Scr->WBorBottom;
  52.     if(Width<=Scr->Width && Height<=Scr->Height)
  53.       return(TRUE);
  54.   }
  55.   return(FALSE);
  56. }
  57.